package cn.gok.thread;

import java.util.List;
import java.util.Random;

/**
 * @ClassName WareHouse
 * @Description TODO
 * @Author HP
 * @Date 9:04 2022/7/13
 * @Version 1.0
 **/
public class WareHouse {
    private List<String> products;
    void procude(String product){
        this.products.add(product);
        System.out.println("剩余数量"+this.products.size());
    }
    private Random rd = new Random();
    private String consume(){
        if (products.isEmpty()){
            return null;
        }
        System.out.println("剩余数量"+this.products.size());
        return this.products.get(rd.nextInt(products.size()));

    }


}
